<?php

namespace App\Observers;

use App\Models\Device;
use App\Models\Manager;
use Illuminate\Support\Carbon;

class ManagerObserver
{
    /**
     * Handle the device "created" event.
     *
     * @param \App\Models\Manager $model
     * @return void
     */
    public function created(Manager $model)
    {
        //
    }

    /**
     * Handle the device "updated" event.
     *todo 更新device
     * @param \App\Models\Manager $model
     * @return void
     */
    public function updated(Manager $model)
    {
        Device::query()->where(['manager_id' => $model->id])->update(['manager_name' => $model->name, 'manager_phone_number' => $model->phone,]);
        //
    }

    /**
     * Handle the device "deleted" event.
     *
     * @param \App\Models\Manager $model
     * @return void
     */
    public function deleted(Manager $model)
    {
        //
    }

    /**
     * Handle the device "restored" event.
     *
     * @param \App\Models\Manager $model
     * @return void
     */
    public function restored(Manager $model)
    {
        //
    }

    /**
     * Handle the device "force deleted" event.
     *
     * @param \App\Models\Manager $model
     * @return void
     */
    public function forceDeleted(Manager $model)
    {
        //
    }

    public function creating(Manager $model)
    {

    }

    public function saving(Manager $model)
    {

    }
}
